<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../plugins/md/css/style.css">
    <link rel="stylesheet" href="../editormd/css/editormd.css">
</head>
<body>
<div id="app">
    <el-menu
            class="el-menu-demo"
            mode="horizontal"
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#ffd04b">
        <el-menu-item index="1">
            <el-link href="index.html" :underline="false">博客首页</el-link>
        </el-menu-item>
        <el-menu-item index="2">下载中心</el-menu-item>
        <el-menu-item index="3">消息中心</el-menu-item>
        <el-menu-item index="4">
            <el-link href="editor.html" :underline="false">创作中心</el-link>
        </el-menu-item>

        <div class="right-menu">
            <el-dropdown class="avatar-container right-menu-item" trigger="click">
                <div class="avatar-wrapper">
                    <img src="../img/logo.jpg" class="user-avatar">
                    {{username}}
                </div>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item divided>
                        <span style="display:block;">修改密码</span>
                    </el-dropdown-item>
                    <el-dropdown-item divided>
                        <span style="display:block;">
                            <a href="http://localhost:9002/sec/logout">退出</a>
                        </span>
                    </el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
    </el-menu>

    <div>
        <el-form ref="form" :model="article" label-width="80px">
            <el-row>
                <el-col :span="8">
                    <el-form-item label="文章题目">
                        <el-input placeholder="请输入文章题目" v-model="article.title" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="8">
                    <el-form-item label="文章分类">
                        <el-checkbox-group v-model="article.categorySelect" v-for="cate in article.category">
                            <el-checkbox :label="cate.name"></el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
    </div>
</div>
<div id="editor">
    <textarea id="my-text" name="my-text" style="display:none;" class="markdown-textarea">### 关于 Editor.md

**Editor.md** 是一款开源的、可嵌入的 Markdown 在线编辑器（组件），基于 CodeMirror、jQuery 和 Marked 构建。
    </textarea>
    <textarea id="text" name="text" style="display:none;"></textarea>
</div>
</body>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>

<script src="../js/axios-0.18.0.js"></script>
<script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script src="../editormd/src/editormd.js"></script>
<script type="text/javascript">
    let editorTest = editormd("editor", {
        width: "90%",
        height: 640,
        syncScrolling: "single",
        path: "../editormd/lib/",//注意2：你的路径
        saveHTMLToTextarea: true,//注意3：这个配置，方便post提交表单
        /**上传图片相关配置如下*/
        imageUpload: true,
        imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"], //图片上传格式
        imageUploadURL: "http://localhost:9002/article/uploadImage",
        onload: function (obj) { //上传成功之后的回调
        }
    });
    new Vue({
        el: '#app',
        data: {
            article: {
                title: '',
                category: [
                    {"id": 1, "name": 'java'},
                    {"id": 2, "name": 'C++'},
                    {"id": 3, "name": 'php'},
                ],
                categorySelect: [],
                content: editorTest.getHTML(),
            },
            username: '',
            backend_url: "http://localhost:9002"
        },

    })
</script>
</html>